@extends('layouts.default') @section('main')
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a>
                <a href="{{url('maker/list')}}" class="tip-bottom">创客空间管理</a>
                <a href="#" class="current">创客空间信息修改</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>基础信息</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('maker/edit')}}" method="post" id="adForm" class="form-horizontal">
                                <div class="control-group">
                                    <label class="control-label">空间ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="id" value="{{$info->id}}" readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>空间名称 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="name" value="{{$info->name}}"   />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">空间创始人 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="leader" value="{{$leader?$leader->nickname:'暂无'}}" readonly="readonly"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">空间成员 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="members" value="@foreach($members as $member){{$member->nickname.'|'}}@endforeach" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">主办的活动 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="orgActivitys" value="@foreach($orgActivitys as $member){{$member->name.'|'}}@endforeach" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">协办的活动 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="assActivitys" value="@foreach($assActivitys as $member){{$member->name.'|'}}@endforeach" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">参与的项目 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="projects" value="@foreach($projects as $member){{$member->subject.'|'}}@endforeach" readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>所在地区 :</label>
                                    <div class="controls">
                                        <select name="province_id" id="city">
                                            <option value="">省份</option>
                                            @foreach($zoneTree as $zone)
                                                <option value="{{$zone['id']}}" @if(isset($family[1]) && $family[1]['id'] == $zone['id']) selected="selected" @endif>{{$zone['name']}}</option>
                                            @endforeach
                                        </select>
                                        <select name="zone_id" id="zone">
                                            <option value="@if(isset($family[0])){{$family[0]['id']}}@endif">@if(isset($family[0])){{$family[0]['name']}}@else城市@endif</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>详细地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="address" value="{{$info->address}}"   />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">坐标 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="coordinate" value="{{$info->coordinate}}" placeholder="经度在前，维度在后，用逗号隔开，如：120.16581,30.30247"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">备注 :</label>
                                    <div class="controls">
                                        <textarea  class="textarea_editor span11" rows="5" name="remark" placeholder="备注">{{$info->remark}}</textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>是否门店 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="if_store"  value="1" @if($info->if_store==1)checked="checked"@endif/>是门店
                                        <input type="radio"  name="if_store" value="0" @if($info->if_store==0)checked="checked"@endif />不是门店                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>电话 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="tel" value="{{$info->tel}}"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">传真 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="fax" value="{{$info->fax}}"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>邮箱 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="email" value="{{$info->email}}"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>是否推荐 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="recommend"  value="1" @if($info->recommend==1)checked="checked"@endif/>推荐
                                        <input type="radio"  name="recommend" value="0" @if($info->recommend==0)checked="checked"@endif />不推荐
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">空间图片 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="image"
                                               placeholder="新空间图片" value="{{$info->image}}"/>
                                        <img src="{{getImage($info->image)}}" width="120px" name="image" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadWxphotoBtn"   onclick="javascript:openBrowse('uploadWxphotoBtn','uploadWxphoto');">点击上传(图片大小不小于h:330像素×w:330像素)</a>
                                        <input type="file" id="uploadWxphoto" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadWxphoto','image')"/>
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">空间图片(详情页) :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="logo" placeholder="空间图片（详情页）" value="{{$info->logo}}" />
                                        <img src="{{getImage($info->logo)}}"  width="120px" name="logo" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadLogoBtn"   onclick="javascript:openBrowse('uploadLogoBtn','uploadLogo');">点击上传</a>
                                        <input type="file" id="uploadLogo" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadLogo','logo')"/>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="zip_code" value="{{$info->zip_code}}" placeholder="邮编" />
                                    </div>
                                </div>


                                <div class="control-group">
                                    <label class="control-label">类型:</label>
                                    <div class="controls">
                                        <select  name="type" class=" span11" >
                                            <option value="">请选择</option>
                                            <option @if($info->type==1)selected="selected" @endif value="1">热门</option>
                                            <option @if($info->type==2)selected="selected" @endif value="2">最新</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>审核状态 :</label>
                                    <div class="controls">
                                        <select  name="status" class=" span11" >
                                            <option  value="">请选择</option>
                                            <option value="1" @if($info->status==1)selected="selected" @endif>审核通过</option>
                                            <option value="-1" @if($info->status==-1)selected="selected" @endif>审核不通过</option>
                                        </select>
                                    </div>
                                </div>
                                <input type="hidden" class="span11" name="formType" value="edit" />
                                <div class="form-actions">
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">确认修改</button>
                                </div>
                            </form>
                            @include('errors.list')
                            @include('message.flash')
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });
        $("#doSave").click(function(){
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
@stop
